{include file="header.html"} 
<script type="text/javascript">
//<!CDATA[
$(function(){
    regionInit("region");
    $("#apply_form").validate({
        errorPlacement: function(error, element){
            var error_td = element.parent('dd');
			error_td.find('label').remove();
            error_td.siblings('dd').remove();
            error_td.append(error);
        },
        success: function(label){
            label.addClass('validate_right').removeClass('error');
        },
        onkeyup: false,
        rules: {
            owner_name: {
                required: true
            },
            store_name: {
                required: true,
                remote : {
                    url  : 'index.php?app=apply&act=check_name&ajax=1',
                    type : 'get',
                    data : {
                        store_name : function(){
                            return $('#store_name').val();
                        },
                        store_id : '{$store.store_id}'
                    }
                },
                maxlength: 20
            },
            tel: {
                required: true,
                minlength:6
            },
            image_1: {
                accept: "jpg|jpeg|png|gif"
            },
            image_2: {
                accept: "jpg|jpeg|png|gif"
            },
            notice: {
                required : true
            }
        },
        messages: {
            owner_name: {
                required: '{$lang.input_owner_name}'
            },
            store_name: {
                required: '{$lang.input_store_name}',
                remote: '{$lang.name_exist}',
                maxlength: '{$lang.note_for_store_name}'
            },
            tel: {
                required: '{$lang.input_tel}',
                minlength: '{$lang.phone_tel_error}'
            },
            image_1: {
                accept: '{$lang.select_valid_image}'
            },
            image_2: {
                accept: '{$lang.select_valid_image}'
            },
            notice: {
                required: '{$lang.check_notice}'
            }
        }
    });

	<!--{if $store && $store.sgrade}-->
	$(".apply-submit li[sgid='{$store.sgrade}']").addClass('selected');
	<!--{else}-->
	$(".apply-submit .each:eq(0)").addClass('selected');
	$('input[name="sgrade_id"]').val($(".apply-submit .each:eq(0)").attr('sgid'));
	<!--{/if}-->

	$(".apply-submit .each").click(function(){
		$(this).addClass('selected');
		$(this).siblings().removeClass('selected');
		$('input[name="sgrade_id"]').val($(this).attr('sgid'));
	});
});
//]]>
</script>
<div id="main" class="w-full">
	<div class="page-apply">
		<div class="padding10 clearfix">
			<div class="apply-submit">
				<form method="post" enctype="multipart/form-data" action="{url app=apply&step=2}" id="apply_form">
					<div class="sgrade clearfix">
						<div class="dt">{$lang.store_grade}</div>
						<ul>
							<!--{foreach from=$sgrades item=sgrade name=fe_sgrade}-->
							<li class="each" sgid="{$sgrade.grade_id}" {if $smarty.foreach.fe_sgrade.iteration % 2 eq 0} style="float:right;"{/if}>
								<h2>{$sgrade.grade_name}</h2>
							</li>
							<!--{/foreach}-->
						</ul>
						<input name="sgrade_id" type="hidden" value="{$store.sgrade}" />
					</div>
					<dl>
						<dt>&nbsp;</dt>
						<dd class="widdt7">
							<input type="text" class="input" name="owner_name" placeholder="{$lang.owner_name}" value="{$store.owner_name|escape}"/>
						</dd>
					</dl>
					<dl>
						<dt>&nbsp;</dt>
						<dd>
							<input type="text" class="input" name="owner_card" placeholder="{$lang.owner_card}" value="{$store.owner_card|escape}" />
						</dd>
					</dl>
					<dl>
						<dt>&nbsp;</dt>
						<dd>
							<input type="text" class="input" name="store_name" id="store_name" placeholder="{$lang.store_name}" value="{$store.store_name|escape}"/>
						</dd>
					</dl>
					<dl>
						<dt class="mt10 mb5">{$lang.store_category}</dt>
						<dd>
							<div class="select_add">
								<select name="cate_id">
									<option value="0">{$lang.select_pls}</option>
								   {html_options options=$scategories selected=$scategory.cate_id}
								</select>
							</div>
						</dd>
					</dl>
					<dl>
						<dt class="mt10 mb5">{$lang.region}</dt>
						<dd>
							<div class="select_add" id="region">
								<input type="hidden" name="region_id" value="{$store.region_id}" class="mls_id" />
								<input type="hidden" name="region_name" value="{$store.region_name}" class="mls_names" />
								{if $store.region_name} <span>{$store.region_name|escape}</span>
								<input type="button" value="{$lang.edit}" class="edit_region" />
								{/if}
								<select class="d_inline"{if $store.region_name} style="display:none;"{/if}>
									<option value="0">{$lang.select_pls}</option>
									 {html_options options=$regions}
								</select>
							</div>
						</dd>
					</dl>
					<dl>
						<dt>&nbsp;</dt>
						<dd>
							<input type="text" class="input" name="address" placeholder="{$lang.address}" value="{$store.address|escape}"/>
						</dd>
					</dl>
					<dl>
						<dt>&nbsp;</dt>
						<dd>
							<input type="text" class="input" name="zipcode" placeholder="{$lang.zipcode}" value="{$store.zipcode|escape}"/>
						</dd>
					</dl>
					<dl>
						<dt>&nbsp;</dt>
						<dd>
							<input type="text" class="input" name="tel" placeholder="{$lang.tel}" value="{$store.tel|escape}"/>
						</dd>
					</dl>
					<dl class="clearboth">
						<dt  class="mt10 mb5">{$lang.upload_image}</dt>
						<dd>
							<input type="file" name="image_1" />
							{if $store.image_1}
							<p class="d_inline"><img src="{$store.image_1}" width="50" style="vertical-align:middle;" /> <a href="{$site_url}/{$store.image_1}" target="_blank">{$lang.view}</a></p>
							{/if} </dd>
					</dl>
					<dl class="clearboth">
						<dt class="mt10 mb5">{$lang.upload_permit}</dt>
						<dd>
							<input type="file" name="image_2" />
							{if $store.image_2}
							<p class="d_inline"><img src="{$store.image_2}" width="50" style="vertical-align:middle;" /> <a href="{$site_url}/{$store.image_2}" target="_blank">{$lang.view}</a></p>
							{/if} </dd>
					</dl>
					<dl class="clearboth">
						<dt>&nbsp;</dt>
						<dd> <span class="btn-alipay">
							<input type="submit" value="{$lang.submit}" />
							</span> </dd>
					</dl>
				</form>
			</div>
		</div>
	</div>
</div>
{include file=footer.html}